


#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
void web_child(int sockfd) {


  int ntowrite;
  ssize_t nread;

  char line[1024], result[1024];

  for ( ;  ;  ) {

    if ((nread = read(sockfd, line, 1024)) == 0) {

      return;
    }
    ntowrite = atol(line);
    if (ntowrite <= 0 && (ntowrite > 1024)) {
      printf("client request for %d bytes\n", ntowrite);
      break;
    }
    write(sockfd, result, ntowrite);
  }
}
